home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / bash / bash_110 / unixmode / src_d3.zoo / patches.zoo / source.diff < prev   
Encoding:
C/C++ Source or Header  |  1991-10-30  |  33.2 KB  |  1,287 lines

  1. diff -c ./bashline.c /home/scott/work/st-bash-1.10/src/bashline.c
  2. *** ./bashline.c    Thu Jul 11 17:36:28 1991
  3. --- /home/scott/work/st-bash-1.10/src/bashline.c    Wed Oct 23 18:45:03 1991
  4. ***************
  5. *** 35,44 ****
  6.   
  7.   static char
  8.     **attempt_shell_completion (), *variable_completion_function (),
  9. !   *hostname_completion_function (), *command_word_completion_function ();
  10.   
  11.   static void
  12.     snarf_hosts_from_file (), add_host_name (), sort_hostname_list ();
  13.   
  14.   /* Externally defined functions used by this file. */
  15.   extern char
  16. --- 35,49 ----
  17.   
  18.   static char
  19.     **attempt_shell_completion (), *variable_completion_function (),
  20. ! #if !defined(atarist)
  21. !   *hostname_completion_function (),  /** sjk++ remove network stuff. **/
  22. ! #endif 
  23. ! *command_word_completion_function ();
  24.   
  25. + #if !defined(atarist)
  26.   static void
  27.     snarf_hosts_from_file (), add_host_name (), sort_hostname_list ();
  28. + #endif 
  29.   
  30.   /* Externally defined functions used by this file. */
  31.   extern char
  32. ***************
  33. *** 61,68 ****
  34. --- 66,78 ----
  35.     bash_complete_filename_internal (),
  36.     bash_complete_username (), bash_possible_username_completions (),
  37.     bash_complete_username_internal (),
  38. + /**
  39. +  ** (sjk)++ Remove hostname/mail references on the Atari ST.
  40. +  **/
  41. + #if !defined(atarist)
  42.     bash_complete_hostname (), bash_possible_hostname_completions (),
  43.     bash_complete_hostname_internal (),
  44. + #endif 
  45.     bash_complete_variable (), bash_possible_variable_completions (),
  46.     bash_complete_variable_internal (),
  47.     bash_complete_command (), bash_possible_command_completions (),
  48. ***************
  49. *** 115,125 ****
  50. --- 125,140 ----
  51.     rl_bind_key_in_map ('~', bash_possible_username_completions,
  52.                 emacs_ctlx_keymap);
  53.   
  54. + /**
  55. +  ** (sjk)++ Remove hostname/mail references on the Atari ST.
  56. +  **/
  57. + #if !defined(atarist)
  58.     rl_add_defun ("complete-hostname", bash_complete_hostname, META('@'));
  59.     rl_add_defun ("possible-hostname-completions",
  60.           bash_possible_hostname_completions, -1);
  61.     rl_bind_key_in_map ('@', bash_possible_hostname_completions,
  62.                 emacs_ctlx_keymap);
  63. + #endif 
  64.   
  65.     rl_add_defun ("complete-variable", bash_complete_variable, META('$'));
  66.     rl_add_defun ("possible-variable-completions",
  67. ***************
  68. *** 209,214 ****
  69. --- 224,233 ----
  70.   /*                                    */
  71.   /* **************************************************************** */
  72.   
  73. + /**
  74. +  ** (sjk)++ Remove hostname/mail references on the Atari ST.
  75. +  **/
  76. + #if !defined(atarist)
  77.   /* If the user requests hostname completion, then simply build a list
  78.      of hosts, and complete from that forever more. */
  79.   #if !defined (ETCHOSTS)
  80. ***************
  81. *** 253,259 ****
  82.     if (hostname_list_length + 2 > hostname_list_size)
  83.       {
  84.         hostname_list = (char **)
  85. !     xrealloc (hostname_list,
  86.             (1 + (hostname_list_size += 100)) * sizeof (char *));
  87.       }
  88.   
  89. --- 272,278 ----
  90.     if (hostname_list_length + 2 > hostname_list_size)
  91.       {
  92.         hostname_list = (char **)
  93. !     xrealloc ((char *)hostname_list,
  94.             (1 + (hostname_list_size += 100)) * sizeof (char *));
  95.       }
  96.   
  97. ***************
  98. *** 408,413 ****
  99. --- 427,433 ----
  100.       }
  101.     return ((char **)NULL);
  102.   }
  103. + #endif 
  104.   
  105.   /* This is a K*rn shell style insert-last-arg function.  The
  106.      difference is that Bash puts stuff into the history file before
  107. ***************
  108. *** 537,544 ****
  109. --- 557,570 ----
  110.   
  111.     /* Another one.  Why not?  If the word starts in '@', then look through
  112.        the world of known hostnames for completion first. */
  113. + /**
  114. +  ** (sjk)++ Remove hostname/mail references on the Atari ST.
  115. +  **/
  116. + #if !defined(atarist)
  117.     if (!matches && *text == '@')
  118.       matches = completion_matches (text, hostname_completion_function);
  119. + #endif
  120.   
  121.     /* And last, (but not least) if this word is in a command position, then
  122.        complete over possible command names, including aliases, functions,
  123. ***************
  124. *** 794,799 ****
  125. --- 820,829 ----
  126.       }
  127.   }
  128.   
  129. + /**
  130. +  ** (sjk)++ Remove hostname/mail references on the Atari ST.
  131. +  **/
  132. + #if !defined(atarist)
  133.   /* How about a completion function for hostnames? */
  134.   static char *
  135.   hostname_completion_function (text, state)
  136. ***************
  137. *** 836,841 ****
  138. --- 866,872 ----
  139.     else
  140.       return ((char *)NULL);
  141.   }
  142. + #endif 
  143.   
  144.   /* History and alias expand the line.  But maybe do more?  This
  145.      is a test to see what users like.  Do expand_string on the string. */
  146. ***************
  147. *** 996,1002 ****
  148.       {
  149.         if (numitems + 1 > maxitems)
  150.       ignores = (struct ign *)
  151. !       xrealloc (ignores, (maxitems += 10) * sizeof (struct ign));
  152.   
  153.         ignores[numitems].val = colon_bit;
  154.         ignores[numitems].len = strlen (colon_bit);
  155. --- 1027,1033 ----
  156.       {
  157.         if (numitems + 1 > maxitems)
  158.       ignores = (struct ign *)
  159. !       xrealloc ((char *)ignores, (maxitems += 10) * sizeof (struct ign));
  160.   
  161.         ignores[numitems].val = colon_bit;
  162.         ignores[numitems].len = strlen (colon_bit);
  163. ***************
  164. *** 1143,1148 ****
  165. --- 1174,1183 ----
  166.     rl_completer_word_break_characters = orig_rl_completer_word_break_characters;
  167.   }
  168.   
  169. + /**
  170. +  ** (sjk)++ Remove hostname/mail references on the Atari ST.
  171. +  **/
  172. + #if !defined(atarist)
  173.   static void
  174.   bash_complete_hostname (ignore, ignore2)
  175.        int ignore, ignore2;
  176. ***************
  177. *** 1156,1161 ****
  178. --- 1191,1197 ----
  179.   {
  180.     bash_complete_hostname_internal ('?');
  181.   }
  182. + #endif 
  183.   
  184.   static void
  185.   bash_complete_variable (ignore, ignore2)
  186. ***************
  187. *** 1186,1191 ****
  188. --- 1222,1231 ----
  189.     bash_complete_command_internal ('?');
  190.   }
  191.   
  192. + /**
  193. +  ** (sjk)++ Remove hostname/mail references on the Atari ST.
  194. +  **/
  195. + #if !defined(atarist)
  196.   static void
  197.   bash_complete_hostname_internal (what_to_do)
  198.        int what_to_do;
  199. ***************
  200. *** 1193,1198 ****
  201. --- 1233,1239 ----
  202.     bash_specific_completion
  203.       (what_to_do, (Function *)hostname_completion_function);
  204.   }
  205. + #endif 
  206.   
  207.   static void
  208.   bash_complete_variable_internal (what_to_do)
  209. diff -c ./braces.c /home/scott/work/st-bash-1.10/src/braces.c
  210. *** ./braces.c    Sun Jul  7 14:36:14 1991
  211. --- /home/scott/work/st-bash-1.10/src/braces.c    Wed Oct 23 18:46:13 1991
  212. ***************
  213. *** 110,116 ****
  214.   #if defined (SHELL)
  215.     /* If the amble does not contain BRACE_ARG_SEPARATOR, then just return
  216.        without doing any expansion.  */
  217. !   if (index (amble, brace_arg_separator) == NULL)
  218.       {
  219.         free (amble);
  220.         free (preamble);
  221. --- 110,116 ----
  222.   #if defined (SHELL)
  223.     /* If the amble does not contain BRACE_ARG_SEPARATOR, then just return
  224.        without doing any expansion.  */
  225. !   if (index (amble, brace_arg_separator) == (int)NULL)
  226.       {
  227.         free (amble);
  228.         free (preamble);
  229. ***************
  230. *** 164,170 ****
  231.         register int lp = array_len (partial);
  232.         register int j;
  233.   
  234. !       result = (char **)xrealloc (result, (1 + lp + lr) * sizeof (char *));
  235.   
  236.         for (j = 0; j < lp; j++)
  237.           result[lr + j] = partial[j];
  238. --- 164,170 ----
  239.         register int lp = array_len (partial);
  240.         register int j;
  241.   
  242. !       result = (char **)xrealloc ((char *)result, (1 + lp + lr) * sizeof (char *));
  243.   
  244.         for (j = 0; j < lp; j++)
  245.           result[lr + j] = partial[j];
  246. diff -c ./config.h /home/scott/work/st-bash-1.10/src/config.h
  247. *** ./config.h    Tue Sep  3 14:41:45 1991
  248. --- /home/scott/work/st-bash-1.10/src/config.h    Wed Oct 23 19:14:01 1991
  249. ***************
  250. *** 59,65 ****
  251.   
  252.   /* Define JOB_CONTROL if your operating system supports
  253.      BSD-like job control. */
  254. ! #define JOB_CONTROL
  255.   
  256.   /* Note that vanilla System V machines don't support BSD job control,
  257.      although some do support Posix job control. */
  258. --- 59,65 ----
  259.   
  260.   /* Define JOB_CONTROL if your operating system supports
  261.      BSD-like job control. */
  262. ! /* #define JOB_CONTROL */
  263.   
  264.   /* Note that vanilla System V machines don't support BSD job control,
  265.      although some do support Posix job control. */
  266. diff -c ./execute_cmd.c /home/scott/work/st-bash-1.10/src/execute_cmd.c
  267. *** ./execute_cmd.c    Thu Oct  3 16:47:59 1991
  268. --- /home/scott/work/st-bash-1.10/src/execute_cmd.c    Thu Oct 24 00:08:17 1991
  269. ***************
  270. *** 617,622 ****
  271. --- 617,627 ----
  272.                  around a bitmap of file descriptors that must be
  273.                  closed after making a child process in
  274.                  execute_simple_command. */
  275. + /** 
  276. +  ** (sjk)++ This above described problem does not exists on the 
  277. +  **         atari ST because of my brain dead pipe implementation.
  278. +  **/
  279. + #if !defined(atarist)
  280.   
  281.               /* We need fd_bitmap to be at least as big as fildes[0].
  282.                  If fildes[0] is less than fds_to_close->size, then
  283. ***************
  284. *** 684,689 ****
  285. --- 689,715 ----
  286.   #if defined (JOB_CONTROL)
  287.           UNBLOCK_CHILD (oset);
  288.   #endif
  289. + #else 
  290. +             if (ignore_return && cmd->value.Connection->first)
  291. +               cmd->value.Connection->first->flags |=
  292. +             CMD_IGNORE_RETURN;
  293. +             execute_command_internal
  294. +               (cmd->value.Connection->first, asynchronous, prev,
  295. +                fildes[1], fds_to_close);
  296. +     
  297. +                     prev = fildes[0];
  298. +            
  299. +                 }
  300. +         cmd = cmd->value.Connection->second;
  301. +            }
  302. +         /* Now execute the rightmost command in the pipeline.  */
  303. +         if (ignore_return && cmd)
  304. +           cmd->flags |= CMD_IGNORE_RETURN;
  305. +         exec_result =
  306. +           execute_command_internal
  307. +         (cmd, asynchronous, prev, pipe_out, fds_to_close);
  308. + #endif
  309.         }
  310.         break;
  311.   
  312. ***************
  313. *** 1574,1580 ****
  314.       {
  315.         /* A command containing a slash is not looked up in PATH. */
  316.         if (absolute_program (words->word->word))
  317. !     command = savestring (words->word->word);
  318.         else
  319.       command = find_user_command (words->word->word);
  320.   
  321. --- 1600,1632 ----
  322.       {
  323.         /* A command containing a slash is not looked up in PATH. */
  324.         if (absolute_program (words->word->word))
  325. !     { /** **/ 
  326. ! /** 
  327. !  ** (sjk)++ Add checking of extensions {.tos/.ttp/.prg} on absolute
  328. !  **         paths on the Atari ST.
  329. !  **/
  330. ! #if defined(atarist)
  331. !         char *name_suffix = alloca(4 + strlen(words->word->word));
  332. !                 struct stat finfo;
  333. !                 strcpy(name_suffix,words->word->word);
  334. !                   if (0 != stat(name_suffix,&finfo))
  335. !                  { strcat(name_suffix,".tos");
  336. !                        if (0 != stat(name_suffix,&finfo)) 
  337. !                           { strcpy(name_suffix,words->word->word);
  338. !                             strcat(name_suffix,".ttp");
  339. !                             if (0 != stat(name_suffix,&finfo)) 
  340. !                        { strcpy(name_suffix,words->word->word);
  341. !                                  strcat(name_suffix,".prg");
  342. !                                  if (0 != stat(name_suffix,&finfo))
  343. !                                     strcpy(name_suffix,words->word->word);
  344. !                    }
  345. !               }
  346. !              }
  347. !                      command = savestring (name_suffix);
  348. ! #else
  349. !               command = savestring (words->word->word);
  350. ! #endif
  351. !           }
  352.         else
  353.       command = find_user_command (words->word->word);
  354.   
  355. ***************
  356. *** 1632,1637 ****
  357. --- 1684,1695 ----
  358.     else
  359.       {
  360.         /* Make sure that the pipes are closed in the parent. */
  361. + /**
  362. +  ** On the Atari ST force GEMDOS buffers into RTL buffers.
  363. +  **/      
  364. + #if defined(atarist)
  365. +             flush_key_buff(fileno(stdin));
  366. + #endif
  367.         close_pipes (pipe_in, pipe_out);
  368.         free (command);
  369.       }
  370. ***************
  371. *** 1884,1889 ****
  372. --- 1942,1951 ----
  373.   do_piping (pipe_in, pipe_out)
  374.        int pipe_in, pipe_out;
  375.   {
  376. + /**
  377. +  ** (sjk)++ on the ST we are more carefulll
  378. +  **/
  379. + #if !defined(atarist)
  380.     if (pipe_in != NO_PIPE)
  381.       {
  382.         dup2 (pipe_in, 0);
  383. ***************
  384. *** 1897,1902 ****
  385. --- 1959,1982 ----
  386.         if (pipe_out == REDIRECT_BOTH)
  387.       dup2 (1, 2);
  388.       }
  389. + #else 
  390. +   int res;
  391. +   if (pipe_in != NO_PIPE)
  392. +     {
  393. +       res = dup2 (pipe_in, 0);
  394. +       if (res < 0) 
  395. +         fprintf(stderr,"pipe_in - dup2:%d, errno:%d\n",res,errno);
  396. +     }
  397. +   if (pipe_out != NO_PIPE)
  398. +     {
  399. +       res = dup2 (pipe_out, 1);
  400. +       if (res < 0)  
  401. +         fprintf(stderr,"pipe_in - dup2:%d, errno:%d\n",res,errno);
  402. +       if (pipe_out == REDIRECT_BOTH)
  403. +     dup2 (1, 2);
  404. +     }
  405. + #endif
  406.   }
  407.   
  408.   /* Defined in flags.c.  Non-zero means don't overwrite existing files. */
  409. ***************
  410. *** 2432,2438 ****
  411. --- 2512,2548 ----
  412.   find_user_command (name)
  413.        char *name;
  414.   {
  415. + /**
  416. +  ** (sjk)++ Check the extensions {.tos/.ttp/.prg} for a user command.
  417. +  **/
  418. + #if defined(atarist)
  419. +   char *win,*name_suffix;
  420. +   name_suffix = (char *)alloca(4 + strlen(name)); 
  421. + #endif
  422. + #if !defined(atarist)   
  423.     return (find_user_command_internal (name, FS_EXEC_PREFERRED));
  424. + #else
  425. +   win = find_user_command_internal(name, 1);
  426. +   if (win != (char *)NULL) return(win);
  427. +  
  428. +   strcpy(name_suffix,name);
  429. +   strcat(name_suffix,".ttp");
  430. +   win = (char *)find_user_command_internal(name_suffix, FS_EXEC_PREFERRED);
  431. +   if (win != (char *)NULL) return(win);
  432. +   strcpy(name_suffix,name);
  433. +   strcat(name_suffix,".tos");
  434. +   win = (char *)find_user_command_internal(name_suffix, FS_EXEC_PREFERRED);
  435. +   if (win != (char *)NULL) return(win);
  436. +   strcpy(name_suffix,name);
  437. +   strcat(name_suffix,".prg");
  438. +   win = (char *)find_user_command_internal(name_suffix, FS_EXEC_PREFERRED);
  439. +   if (win != (char *)NULL) return(win);
  440. +   return(win);
  441. + #endif                               
  442.   }
  443.   
  444.   /* Locate the file referenced by NAME, searching along the contents
  445. diff -c ./expr.c /home/scott/work/st-bash-1.10/src/expr.c
  446. *** ./expr.c    Sun Aug  4 15:17:33 1991
  447. --- /home/scott/work/st-bash-1.10/src/expr.c    Wed Oct 23 19:19:42 1991
  448. ***************
  449. *** 147,153 ****
  450.     if (expr_depth >= expr_stack_size)
  451.       {
  452.         expr_stack = (EXPR_CONTEXT **)
  453. !     xrealloc (expr_stack, (expr_stack_size += EXPR_STACK_GROW_SIZE)
  454.             * sizeof (EXPR_CONTEXT *));
  455.       }
  456.   
  457. --- 147,153 ----
  458.     if (expr_depth >= expr_stack_size)
  459.       {
  460.         expr_stack = (EXPR_CONTEXT **)
  461. !     xrealloc ((char *)expr_stack, (expr_stack_size += EXPR_STACK_GROW_SIZE)
  462.             * sizeof (EXPR_CONTEXT *));
  463.       }
  464.   
  465. diff -c ./general.c /home/scott/work/st-bash-1.10/src/general.c
  466. *** ./general.c    Sun Jul  7 17:24:41 1991
  467. --- /home/scott/work/st-bash-1.10/src/general.c    Wed Oct 23 19:15:36 1991
  468. ***************
  469. *** 69,75 ****
  470.   
  471.   char *
  472.   xmalloc (size)
  473. !      int size;
  474.   {
  475.     register char *temp = (char *)malloc (size);
  476.   
  477. --- 69,75 ----
  478.   
  479.   char *
  480.   xmalloc (size)
  481. ! long size;
  482.   {
  483.     register char *temp = (char *)malloc (size);
  484.   
  485. ***************
  486. *** 82,88 ****
  487.   char *
  488.   xrealloc (pointer, size)
  489.        register char *pointer;
  490. !      int size;
  491.   {
  492.     char *temp;
  493.   
  494. --- 82,88 ----
  495.   char *
  496.   xrealloc (pointer, size)
  497.        register char *pointer;
  498. ! long size;
  499.   {
  500.     char *temp;
  501.   
  502. ***************
  503. *** 158,166 ****
  504.   unset_nodelay_mode (fd)
  505.        int fd;
  506.   {
  507.     int flags, set = 0;
  508.   
  509. !   if ((flags = fcntl (fd, F_GETFL, 0)) < 0)
  510.       return;
  511.   
  512.   #if defined (O_NONBLOCK)
  513. --- 158,174 ----
  514.   unset_nodelay_mode (fd)
  515.        int fd;
  516.   {
  517. + /**
  518. +  ** (sjk)++ We remove the call to make stdin a noblocking stream, since this 
  519. +             is not a feature of our limited fcntl() call. No blocking Input 
  520. +         is however taken care of by the console_input_status()
  521. +             and console_read_byte() pair in the readline source code.
  522. +  **/
  523. + #if !defined(atarist)
  524.     int flags, set = 0;
  525.   
  526. !   if ((flags = fcntl(fd, F_GETFL, 0)) < 0)
  527.       return;
  528.   
  529.   #if defined (O_NONBLOCK)
  530. ***************
  531. *** 181,186 ****
  532. --- 189,195 ----
  533.   
  534.     if (set)
  535.       fcntl (fd, F_SETFL, flags);
  536. + #endif 
  537.   }
  538.   
  539.   
  540. ***************
  541. *** 406,411 ****
  542. --- 415,429 ----
  543.   {
  544.     register char *cp;
  545.   
  546. + /** 
  547. +  ** (sjk)++ let the string "[a..z]:" pass through as is is a valid drive 
  548. +  **         specification on the Atari ST.
  549. +  **/
  550. + #if defined(atarist)
  551. +   if ((strlen(string)>1) && (string[1] == ':'))
  552. +     return(savestring (string));
  553. + #endif 
  554. +  
  555.     if (!dot_path || *string == '/')
  556.       return (savestring (string));
  557.   
  558. diff -c ./general.h /home/scott/work/st-bash-1.10/src/general.h
  559. *** ./general.h    Sat Jul 13 23:40:27 1991
  560. --- /home/scott/work/st-bash-1.10/src/general.h    Wed Oct 23 19:15:02 1991
  561. ***************
  562. *** 76,82 ****
  563.   #define FS_EXEC_PREFERRED 0x4
  564.   #define FS_EXEC_ONLY      0x8
  565.   
  566. - extern char *xmalloc (), *malloc (), *xrealloc (), *realloc ();
  567.   extern char *itos ();
  568.   
  569.   #endif    /* _GENERAL_ */
  570. --- 76,84 ----
  571.   #define FS_EXEC_PREFERRED 0x4
  572.   #define FS_EXEC_ONLY      0x8
  573.   
  574.   extern char *itos ();
  575.   
  576.   #endif    /* _GENERAL_ */
  577. diff -c ./mailcheck.c /home/scott/work/st-bash-1.10/src/mailcheck.c
  578. *** ./mailcheck.c    Sun Jul  7 17:25:49 1991
  579. --- /home/scott/work/st-bash-1.10/src/mailcheck.c    Wed Oct 23 19:22:16 1991
  580. ***************
  581. *** 24,29 ****
  582. --- 24,35 ----
  583.   #include <sys/param.h>
  584.   #include "shell.h"
  585.   
  586. + /**
  587. +  ** (sjk)++ Remove all host/mail references on the Atari ST1
  588. +  **/
  589. + #if !defined(atarist)
  590.   #include "maxpath.h"
  591.   
  592.   #ifndef NOW
  593. ***************
  594. *** 148,153 ****
  595. --- 154,160 ----
  596.     mailfiles_count = 0;
  597.     mailfiles = (FILEINFO **)NULL;
  598.   }
  599. + #endif 
  600.   
  601.   /* Return the full pathname of FILE.  Easy.  Filenames that begin
  602.      with a '/' are returned as themselves.  Other filenames have
  603. ***************
  604. *** 190,195 ****
  605. --- 197,207 ----
  606.     }
  607.   }
  608.   
  609. + /**
  610. +  ** (sjk)++ Remove all host/mail references on the Atari ST
  611. +  **/
  612. + #if !defined(atarist)
  613.   /* Return non-zero if FILE's mod date has changed. */
  614.   file_mod_date_changed (file)
  615.        char *file;
  616. ***************
  617. *** 404,406 ****
  618. --- 416,419 ----
  619.     free (mailpaths);
  620.     bind_variable ("_", dollar_underscore);
  621.   }
  622. + #endif 
  623. diff -c ./nojobs.c /home/scott/work/st-bash-1.10/src/nojobs.c
  624. *** ./nojobs.c    Mon Sep 30 23:27:27 1991
  625. --- /home/scott/work/st-bash-1.10/src/nojobs.c    Wed Oct 23 19:28:38 1991
  626. ***************
  627. *** 46,56 ****
  628.   #define SIGABRT SIGIOT
  629.   #endif
  630.   
  631. ! #if defined (USG) || defined (_POSIX_VERSION)
  632.   #define killpg(pg, sig)        kill(-(pg),(sig))
  633.   #endif
  634.   
  635. ! #if defined (USG)
  636.   #define siginterrupt(sig, code)
  637.   #endif
  638.   
  639. --- 46,62 ----
  640.   #define SIGABRT SIGIOT
  641.   #endif
  642.   
  643. ! /**
  644. !  ** (sjk)++ Remove all host/mail references on the Atari ST1
  645. !  **/
  646. ! #if defined (USG) || defined (_POSIX_VERSION) || defined(atarist)
  647.   #define killpg(pg, sig)        kill(-(pg),(sig))
  648.   #endif
  649.   
  650. ! /**
  651. !  ** (sjk)++ Make siginterrupt() a NULL code on the Atari ST
  652. !  **/
  653. ! #if defined (USG) || defined(atarist)
  654.   #define siginterrupt(sig, code)
  655.   #endif
  656.   
  657. ***************
  658. *** 143,148 ****
  659. --- 149,161 ----
  660.     return (pid);
  661.   }
  662.   
  663. + /**
  664. +  ** (sjk)++ Define ECHILD to be an unknown/general ERROR code for the Atari ST
  665. +  **/
  666. + #if defined(atarist)
  667. + #define ECHILD (-1)
  668. + #endif
  669.   /* Wait for a single pid (PID) and return its exit status. */
  670.   wait_for_single_pid (pid)
  671.        pid_t pid;
  672. ***************
  673. *** 186,192 ****
  674.         WAIT status;
  675.   
  676.         while ((got_pid = wait(&status)) != -1)  /* wait for ECHILD */
  677. !     ;
  678.         if (errno != EINTR && errno != ECHILD)
  679.       {
  680.         siginterrupt (SIGINT, 0);
  681. --- 199,206 ----
  682.         WAIT status;
  683.   
  684.         while ((got_pid = wait(&status)) != -1)  /* wait for ECHILD */
  685. !      printf("Stuck in wait loop with got_pid = %d\n",got_pid);
  686.         if (errno != EINTR && errno != ECHILD)
  687.       {
  688.         siginterrupt (SIGINT, 0);
  689. ***************
  690. *** 294,300 ****
  691. --- 308,321 ----
  692.   /* Fill the contents of shell_tty_info with the current tty info. */
  693.   get_tty_state ()
  694.   {
  695. + /**
  696. +  ** (sjk)++ Attach the terminal to CON: on the Atari ST
  697. +  **/
  698. + #if !defined(atarist)
  699.     int tty = open ("/dev/tty", O_RDONLY);
  700. + #else 
  701. +   int tty = open("CON:", O_RDONLY);
  702. + #endif 
  703.     if (tty != -1)
  704.       {
  705.      
  706. ***************
  707. *** 315,321 ****
  708. --- 336,349 ----
  709.   /* Make the current tty use the state in shell_tty_info. */
  710.   set_tty_state ()
  711.   {
  712. + /**
  713. +  ** (sjk)++ Attach the terminal to CON: on the Atari ST
  714. +  **/
  715. + #if !defined(atarist)
  716.     int tty = open ("/dev/tty", O_RDONLY);
  717. + #else 
  718. +   int tty = open("CON:", O_RDONLY);
  719. + #endif 
  720.     if (tty != -1)
  721.       {
  722.         if (!got_tty_state)
  723. ***************
  724. *** 326,336 ****
  725.   #if defined (_POSIX_VERSION)
  726.         tcsetattr (tty, TCSADRAIN, &shell_tty_info);
  727.   #else
  728. ! #  if defined (USG)
  729. !       ioctl (tty, TCSETAW, &shell_tty_info);  /* Wait for output, no flush */
  730. ! #  else
  731.         ioctl (tty, TIOCSETN, &shell_tty_info);
  732. ! #  endif
  733.   #endif
  734.         close (tty);
  735.       }
  736. --- 354,367 ----
  737.   #if defined (_POSIX_VERSION)
  738.         tcsetattr (tty, TCSADRAIN, &shell_tty_info);
  739.   #else
  740. ! /** 
  741. !  ** (sjk)++ Set the terminal parameters ala USG if on an Atari ST
  742. !  **/
  743. ! #if defined (USG) || defined(atarist)
  744.         ioctl (tty, TIOCSETN, &shell_tty_info);
  745. ! #else
  746. !       ioctl (tty, TCSETAW, &shell_tty_info);  /* Wait for output, no flush */
  747. ! #endif
  748.   #endif
  749.         close (tty);
  750.       }
  751. diff -c ./parse.y /home/scott/work/st-bash-1.10/src/parse.y
  752. *** ./parse.y    Thu Oct  3 17:17:09 1991
  753. --- /home/scott/work/st-bash-1.10/src/parse.y    Wed Oct 23 19:27:08 1991
  754. ***************
  755. *** 677,682 ****
  756. --- 677,686 ----
  757.   /*                                    */
  758.   /* **************************************************************** */
  759.   
  760. + #if defined(atarist)
  761. + extern int console_read_byte();
  762. + #endif
  763.   int
  764.   yy_stream_get ()
  765.   {
  766. ***************
  767. *** 684,690 ****
  768. --- 688,701 ----
  769.   #if defined (USG)
  770.       return (sysv_getc (yy_input_dev));
  771.   #else
  772. + /**
  773. +  ** (sjk)++ Atari ST hack for input
  774. +  **/
  775. + #if !defined(atarist)
  776.       return (getc (yy_input_dev));
  777. + #else 
  778. +     return(console_read_byte(fileno(yy_input_dev)));
  779. + #endif 
  780.   #endif    /* USG */
  781.     else return (EOF);
  782.   }
  783. ***************
  784. *** 1353,1358 ****
  785. --- 1364,1374 ----
  786.   {
  787.     if (interactive && (!current_token || current_token == '\n'))
  788.       {
  789. + /**
  790. +  ** (sjk)++
  791. +  **/
  792. + #if !defined(atarist)
  793.         /* Before we print a prompt, we might have to check mailboxes.
  794.        We do this only if it is time to do so. Notice that only here
  795.        is the mail alarm reset; nothing takes place in check_mail ()
  796. ***************
  797. *** 1362,1367 ****
  798. --- 1378,1384 ----
  799.         check_mail ();
  800.         reset_mail_timer ();
  801.       }
  802. + #endif
  803.   
  804.         /* Allow the execution of a random command just before the printing
  805.        of each primary prompt.  If the shell variable PROMPT_COMMAND
  806. diff -c ./shell.c /home/scott/work/st-bash-1.10/src/shell.c
  807. *** ./shell.c    Thu Oct  3 16:39:06 1991
  808. --- /home/scott/work/st-bash-1.10/src/shell.c    Wed Oct 23 19:17:26 1991
  809. ***************
  810. *** 135,142 ****
  811. --- 135,150 ----
  812.   
  813.   /* The environment at the top-level REP loop.  We use this in the case of
  814.      error return. */
  815. + /**
  816. +  ** (sjk)++ catch is defined in setjmp.h on the Atari ST
  817. +  **/
  818. + #if !defined(atarist)
  819.   jmp_buf top_level, catch;
  820. + #else 
  821. + jmp_buf top_level;
  822. + #endif
  823.   
  824.   /* Non-zero is the recursion depth for commands. */
  825.   int indirection_level = 0;
  826.   
  827. ***************
  828. *** 240,245 ****
  829. --- 248,263 ----
  830.     }
  831.   #endif /* NeXT */
  832.   
  833. + /**
  834. +  ** (sjk)++ Set the default unixmode as we cannot assume that the variable 
  835. +  **         is set upon entering the shell.
  836. +  **/
  837. + #if defined(atarist)
  838. +  if (!getenv("UNIXMODE")) _set_unixmode("/.,rCLAHdb");
  839. +     else _set_unixmode(getenv("UNIXMODE"));
  840. + #endif
  841.     /* Wait forever if we are debugging a login shell. */
  842.     while (debugging_login_shell);
  843.   
  844. ***************
  845. *** 602,607 ****
  846. --- 620,629 ----
  847.     /* Do the things that should be done only for interactive shells. */
  848.     if (interactive_shell)
  849.       {
  850. + /**
  851. +  ** (sjk)++ Remove all host/mail code on the Atari ST
  852. +  **/
  853. + #if !defined(atarist)
  854.         /* Set up for checking for presence of mail. */
  855.   #if defined (USG)
  856.         /* Under System V, we can only tell if you have mail if the
  857. ***************
  858. *** 625,630 ****
  859. --- 647,653 ----
  860.       }
  861.   
  862.         reset_mail_timer ();
  863. + #endif 
  864.   
  865.         change_flag_char ('i', FLAG_ON);
  866.   
  867. ***************
  868. *** 1015,1021 ****
  869.     /* Only do timeouts if interactive. */
  870.     if (interactive)
  871.       {
  872. !       tmout_var = find_variable ("TMOUT");
  873.   
  874.         if (tmout_var && tmout_var->value)
  875.       {
  876. --- 1038,1048 ----
  877.     /* Only do timeouts if interactive. */
  878.     if (interactive)
  879.       {
  880. ! /**
  881. !  ** (sjk)++ There is no nead to do an interative timeout on the Atari ST
  882. !  **/
  883. ! #if !defined(atarist)
  884. !      tmout_var = find_variable ("TMOUT");
  885.   
  886.         if (tmout_var && tmout_var->value)
  887.       {
  888. ***************
  889. *** 1026,1031 ****
  890. --- 1053,1059 ----
  891.             alarm (tmout_len);
  892.           }
  893.       }
  894. + #endif
  895.       }
  896.   
  897.     QUIT;
  898. ***************
  899. *** 1032,1042 ****
  900. --- 1060,1075 ----
  901.   
  902.     result = parse_command ();
  903.   
  904. + /**
  905. +  ** (sjk)++ There is no need for an interactive timeout on the Atari ST
  906. +  **/
  907. + #if !defined(atarist)
  908.     if (interactive && tmout_var && (tmout_len > 0))
  909.       {
  910.         alarm(0);
  911.         signal (SIGALRM, old_alrm);
  912.       }
  913. + #endif
  914.     return (result);
  915.   }
  916.   
  917. ***************
  918. *** 1376,1382 ****
  919.   sigint_sighandler (sig)
  920.        int sig;
  921.   {
  922. ! #if defined (USG) && !defined (_POSIX_VERSION)
  923.     signal (sig, sigint_sighandler);
  924.   #endif
  925.   
  926. --- 1409,1418 ----
  927.   sigint_sighandler (sig)
  928.        int sig;
  929.   {
  930. ! /**
  931. !  **  (sjk)++ Offer up the signal ala USG on the Atari ST
  932. !  **/
  933. ! #if (defined (USG) && !defined(_POSIX_VERSION)) || defined(atarist)
  934.     signal (sig, sigint_sighandler);
  935.   #endif
  936.   
  937. diff -c ./shell.h /home/scott/work/st-bash-1.10/src/shell.h
  938. *** ./shell.h    Mon Sep 30 05:42:53 1991
  939. --- /home/scott/work/st-bash-1.10/src/shell.h    Wed Oct 23 16:30:17 1991
  940. ***************
  941. *** 18,24 ****
  942. --- 18,31 ----
  943.   /* A bunch of stuff for flow of control using setjmp () and longjmp (). */
  944.   
  945.   #include <setjmp.h>
  946. + /**
  947. +  ** (sjk)++ catch is defined in setjmp.h on the Atari ST
  948. +  **/
  949. + #if !defined(atarist)
  950.   extern jmp_buf top_level, catch;
  951. + #else
  952. + extern jmp_buf top_level;
  953. + #endif
  954.   
  955.   #define NOT_JUMPED 0        /* Not returning from a longjmp. */
  956.   #define FORCE_EOF 1        /* We want to stop parsing. */
  957. diff -c ./subst.c /home/scott/work/st-bash-1.10/src/subst.c
  958. *** ./subst.c    Thu Oct  3 16:37:36 1991
  959. --- /home/scott/work/st-bash-1.10/src/subst.c    Wed Oct 23 19:26:36 1991
  960. ***************
  961. *** 2694,2700 ****
  962.            continue.  In the common case, at least when running shell
  963.            scripts, this will degenerate to a bunch of calls to `index',
  964.            and then what is basically the body of copy_word_list. */
  965. !       if (index (tlist->word->word, '{') != NULL)
  966.           {
  967.             expansions = brace_expand (tlist->word->word);
  968.   
  969. --- 2694,2700 ----
  970.            continue.  In the common case, at least when running shell
  971.            scripts, this will degenerate to a bunch of calls to `index',
  972.            and then what is basically the body of copy_word_list. */
  973. !       if (index ((tlist->word->word), '{') != (int)NULL)
  974.           {
  975.             expansions = brace_expand (tlist->word->word);
  976.   
  977. ***************
  978. *** 2955,2963 ****
  979.   
  980.   /* The functions that get called. */
  981.   int
  982. !   sv_path (), sv_mail (), sv_terminal (), sv_histsize (), sv_histfilesize (),
  983.     sv_uids (), sv_ignoreeof (), sv_glob_dot_filenames (), sv_histchars (),
  984. !   sv_nolinks (), sv_hostname_completion_file (), sv_history_control (),
  985.     sv_noclobber (), sv_allow_null_glob_expansion ();
  986.   
  987.   #if defined (GETOPTS_BUILTIN)
  988. --- 2955,2971 ----
  989.   
  990.   /* The functions that get called. */
  991.   int
  992. !   sv_path (), 
  993. ! #if !defined(atarist)
  994. !   sv_mail (), 
  995. ! #endif 
  996. !   sv_terminal (), sv_histsize (), sv_histfilesize (),
  997.     sv_uids (), sv_ignoreeof (), sv_glob_dot_filenames (), sv_histchars (),
  998. !   sv_nolinks (), 
  999. ! #if !defined(atarist)
  1000. !   sv_hostname_completion_file (), 
  1001. ! #endif 
  1002. !   sv_history_control (),
  1003.     sv_noclobber (), sv_allow_null_glob_expansion ();
  1004.   
  1005.   #if defined (GETOPTS_BUILTIN)
  1006. ***************
  1007. *** 2973,2981 ****
  1008. --- 2981,2994 ----
  1009.     Function *function;
  1010.   } special_vars[] = {
  1011.     { "PATH", sv_path },
  1012. + /**
  1013. +  ** (sjk)++ Remove all host/mail references on the Atari ST
  1014. +  **/
  1015. + #if !defined(atarist)
  1016.     { "MAIL", sv_mail },
  1017.     { "MAILPATH", sv_mail },
  1018.     { "MAILCHECK", sv_mail },
  1019. + #endif
  1020.     { "TERMCAP", sv_terminal },
  1021.     { "TERM", sv_terminal },
  1022.     { "HISTSIZE", sv_histsize },
  1023. ***************
  1024. *** 2995,3001 ****
  1025. --- 3008,3019 ----
  1026.     { "allow_null_glob_expansion", sv_allow_null_glob_expansion },
  1027.     { "histchars", sv_histchars },
  1028.     { "nolinks", sv_nolinks },
  1029. + /**
  1030. +  ** (sjk)++ Remove all host/mail references on the Atari ST
  1031. +  **/
  1032. + #if !defined(atarist)
  1033.     { "hostname_completion_file", sv_hostname_completion_file },
  1034. + #endif
  1035.     { "history_control", sv_history_control },
  1036.     { "noclobber", sv_noclobber },
  1037.     { (char *)0x00, (Function *)0x00 }
  1038. ***************
  1039. *** 3045,3050 ****
  1040. --- 3063,3072 ----
  1041.   
  1042.   /* What to do just after one of the MAILxxxx variables has changed.  NAME
  1043.      is the name of the variable.  */
  1044. + /**
  1045. +  ** (sjk)++ Remove all host/mail references on the Atari ST
  1046. +  **/
  1047. + #if !defined(atarist)
  1048.   sv_mail (name)
  1049.        char *name;
  1050.   {
  1051. ***************
  1052. *** 3063,3068 ****
  1053. --- 3085,3091 ----
  1054.       }
  1055.       }
  1056.   }
  1057. + #endif 
  1058.   
  1059.   /* What to do just after one of the TERMxxx variables has changed.
  1060.      If we are an interactive shell, then try to reset the terminal
  1061. ***************
  1062. *** 3261,3266 ****
  1063. --- 3284,3293 ----
  1064.     v->attributes |= (att_readonly | att_integer);
  1065.   }
  1066.   
  1067. + /**
  1068. +  ** (sjk)++ Remove all host/mail references on the Atari ST
  1069. +  **/
  1070. + #if !defined(atarist)
  1071.   sv_hostname_completion_file (name)
  1072.        char *name;
  1073.   {
  1074. ***************
  1075. *** 3268,3273 ****
  1076. --- 3295,3301 ----
  1077.   
  1078.     hostname_list_initialized = 0;
  1079.   }
  1080. + #endif 
  1081.   
  1082.   sv_allow_null_glob_expansion (name)
  1083.        char *name;
  1084. diff -c ./trap.c /home/scott/work/st-bash-1.10/src/trap.c
  1085. *** ./trap.c    Thu Oct  3 16:33:48 1991
  1086. --- /home/scott/work/st-bash-1.10/src/trap.c    Wed Oct 23 19:12:53 1991
  1087. ***************
  1088. *** 286,294 ****
  1089. --- 286,299 ----
  1090.   /* Non-zero when we catch a trapped signal. */
  1091.   static int catch_flag = 0;
  1092.   
  1093. + /**
  1094. +  ** (sjk)++ NO BSD type signals on the Atari ST1
  1095. +  **/
  1096. + #if !defined(atarist)
  1097.   #if !defined (USG) && !defined (USGr4)
  1098.   #define HAVE_BSD_SIGNALS
  1099.   #endif
  1100. + #endif
  1101.   
  1102.   run_pending_traps ()
  1103.   {
  1104. ***************
  1105. *** 437,446 ****
  1106.   ignore_signal (sig)
  1107.        int sig;
  1108.   {
  1109. - #ifdef SIGCHLD
  1110.     /* Don't allow the SIGCHLD signal catcher to be overridden. */
  1111.     if (sig != SIGCHLD)
  1112. - #endif
  1113.       signal (sig, SIG_IGN);
  1114.     change_signal (sig, (char *)IGNORE_SIG);
  1115.   }
  1116. --- 442,449 ----
  1117. diff -c ./variables.c /home/scott/work/st-bash-1.10/src/variables.c
  1118. *** ./variables.c    Sun Jul 28 16:24:29 1991
  1119. --- /home/scott/work/st-bash-1.10/src/variables.c    Wed Oct 23 19:22:59 1991
  1120. ***************
  1121. *** 66,76 ****
  1122. --- 66,81 ----
  1123.   /* The list of variables that may not be unset in this shell. */
  1124.   char **non_unsettable_vars = (char **)NULL;
  1125.   
  1126. + /**
  1127. +  **  (sjk)++ Remove all mail references on the Atari ST 
  1128. +  **/
  1129. + #if !defined(atarist)   
  1130.   #if defined (USG)
  1131.   #define DEFAULT_MAIL_PATH "/usr/mail/"
  1132.   #else
  1133.   #define DEFAULT_MAIL_PATH "/usr/spool/mail/"
  1134.   #endif
  1135. + #endif 
  1136.   
  1137.   /* Some forward declarations. */
  1138.   SHELL_VAR *set_if_not ();    /* returns new or existing entry */
  1139. ***************
  1140. *** 138,143 ****
  1141. --- 143,159 ----
  1142.   
  1143.     /* Now make our own defaults in case the vars that we think are
  1144.        important are missing. */
  1145. + /**
  1146. +  ** (sjk)++ We set some default environment variables, provided 
  1147. +  **         that they are not defined.
  1148. +  **/
  1149. + #if defined(atarist)
  1150. +   set_if_not("UNIXMODE","/.,rCLAHdb");   /* Set a default Unixmode */ 
  1151. +   set_if_not("HOME","/dev/A");
  1152. +   set_if_not("TERM","vt52");
  1153. + #endif 
  1154.     temp_var = set_if_not ("PATH", DEFAULT_PATH_VALUE);
  1155.     set_auto_export (temp_var);
  1156.   
  1157. ***************
  1158. *** 152,157 ****
  1159. --- 168,177 ----
  1160.     temp_var = set_if_not ("HOSTTYPE", HOSTTYPE);
  1161.     set_auto_export (temp_var);
  1162.   
  1163. + /**
  1164. +  **  (sjk)++ Remove all mail references on the Atari ST 
  1165. +  **/
  1166. + #if !defined(atarist)   
  1167.     /* Default MAILPATH, and MAILCHECK. */
  1168.     set_if_not ("MAILCHECK", "60");
  1169.     if ((get_string_value ("MAIL") == (char *)NULL) &&
  1170. ***************
  1171. *** 168,173 ****
  1172. --- 188,194 ----
  1173.         bind_variable ("MAILPATH", tem);
  1174.         free (tem);
  1175.       }
  1176. + #endif
  1177.   
  1178.     /* Set up $PWD. */
  1179.     {
  1180. ***************
  1181. *** 282,288 ****
  1182.       set_if_not ("HISTFILE", tem);
  1183.       free (tem);
  1184.   
  1185. !     set_if_not ("HISTSIZE", "500");
  1186.       sv_histsize ("HISTSIZE");
  1187.     }
  1188.   
  1189. --- 303,309 ----
  1190.       set_if_not ("HISTFILE", tem);
  1191.       free (tem);
  1192.   
  1193. !     set_if_not ("HISTSIZE", "50");
  1194.       sv_histsize ("HISTSIZE");
  1195.     }
  1196.   
  1197. ***************
  1198. *** 352,358 ****
  1199.         return;
  1200.   
  1201.     non_unsettable_vars = (char **)
  1202. !     xrealloc (non_unsettable_vars, (2 + i) * sizeof (char *));
  1203.     non_unsettable_vars[i] = savestring (name);
  1204.     non_unsettable_vars[i + 1] = (char *)NULL;
  1205.   }
  1206. --- 373,379 ----
  1207.         return;
  1208.   
  1209.     non_unsettable_vars = (char **)
  1210. !     xrealloc ((char *)non_unsettable_vars, (2 + i) * sizeof (char *));
  1211.     non_unsettable_vars[i] = savestring (name);
  1212.     non_unsettable_vars[i + 1] = (char *)NULL;
  1213.   }
  1214. ***************
  1215. *** 395,401 ****
  1216.           {
  1217.             if (list_index + 1 >= list_size)
  1218.           list = (SHELL_VAR **)
  1219. !           xrealloc (list, (list_size += 20) * sizeof (SHELL_VAR *));
  1220.   
  1221.             list[list_index++] = var;
  1222.             list[list_index] = (SHELL_VAR *)NULL;
  1223. --- 416,422 ----
  1224.           {
  1225.             if (list_index + 1 >= list_size)
  1226.           list = (SHELL_VAR **)
  1227. !           xrealloc ((char *)list, (list_size += 20) * sizeof (SHELL_VAR *));
  1228.   
  1229.             list[list_index++] = var;
  1230.             list[list_index] = (SHELL_VAR *)NULL;
  1231. ***************
  1232. *** 1365,1371 ****
  1233.   
  1234.     size = array_len (temporary_env);
  1235.     temporary_env = (char **)
  1236. !     xrealloc (temporary_env, (size + 2) * (sizeof (char *)));
  1237.   
  1238.     temporary_env[size] = (temp);
  1239.     temporary_env[size + 1] = (char *)NULL;
  1240. --- 1386,1392 ----
  1241.   
  1242.     size = array_len (temporary_env);
  1243.     temporary_env = (char **)
  1244. !     xrealloc ((char *)temporary_env, (size + 2) * (sizeof (char *)));
  1245.   
  1246.     temporary_env[size] = (temp);
  1247.     temporary_env[size + 1] = (char *)NULL;
  1248. ***************
  1249. *** 1557,1563 ****
  1250.   #if !defined (NeXT)
  1251.   char *
  1252.   getenv (name)
  1253. !      char *name;
  1254.   {
  1255.     SHELL_VAR *var = find_tempenv_variable (name);
  1256.   
  1257. --- 1578,1584 ----
  1258.   #if !defined (NeXT)
  1259.   char *
  1260.   getenv (name)
  1261. !      const char *name;
  1262.   {
  1263.     SHELL_VAR *var = find_tempenv_variable (name);
  1264.